var models = require('../db');
var express = require('express');
const jwt = require('jsonwebtoken');
var uuid = require('node-uuid');
var router = express.Router();
var mysql = require('mysql');
var $sql = require('../sql');
 
// 连接数据库
var conn = mysql.createConnection(models.mysql);
 
conn.connect();

// 查询图书列表
router.post('/getBooksList', (req, res) => {
  var sql = $sql.books.queryBooksList;
  var params = req.body;
  conn.query(sql, [], function (err, result) {
    var data = JSON.parse(JSON.stringify(result))
    return res.send({
      status: 1,
      msg: "查询成功",
      list: data
    })
  })
});
module.exports = router;